<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*" errorPage="" %>
<%@ include file="/system/include/taglib.jsp"%>
<html>
<head>
<base href="${pageScope.basePath }">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>中山市美斯特实业有限公司</title>
<link type="text/css" rel="stylesheet" href="system/css/style.css" />
<script type="text/javascript" language="javascript" src="system/js/public.js"></script>
<script type="text/javascript" src="system/js/jquery-1.4.2.js"></script>
<script type="text/javascript" src="system/js/validate.js"></script>
<script type="text/javascript">
	$(document).ready(function(){			
				validate_Effect("#menuName","[菜单名不能为空！]");
				validateNumber_Effect("#menuSort","排序非法，要求是正整数!");	
				validate_Effect("#actionKey","[操作键不能为空！]");						
			//通过ajax，为指定的控件验证其值是否存在。并将返回的信息放到控件后。。。。
			$("#actionKey").blur(function(){
			  		var actionKey=$("#actionKey").val();//动态设置json传递参数，以及相应的形参。。。。。。
			  		ajaxRequest_validate("#actionKey","system/ajax/menu.do?method=validate",{"actionKey":actionKey});
			});	

});	


function checkForm(){	
	var menuNameIsNull=validateValueIsNull("#menuName");
	if(menuNameIsNull){
		return false;
	}
	var menuSortIsRight=validateNumberIsRight("#menuSort");
	if(!menuSortIsRight){
		return false;
	}
	var actionKeyIsNull=validateValueIsNull("#actionKey");
	if(actionKeyIsNull){
		return false;
	}	
	else{
		return true;
	}
}
</script>
</head>
<body>
<div class="main">
	<div class="position">当前位置: <a href="sysadm/desktop.jsp">桌 面</a> → 添加菜单</div>
	<div class="mainbody">
		<div class="operate_info">操作说明：带 * 号必填</div>
		<div class="table">
		<form action="system/config/menu_add.do" method="post" onsubmit="return checkForm()">
			<table width="100%" border="0" cellpadding="1" cellspacing="1" class="table_form">
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">菜单名称：</td>
						<td><input name="menuName" id="menuName" />　*必填 如：测试 </td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">上级菜单：</td>
						<td>
									<select name="menuParent">	
									 <option value ="0" selected="selected">无</option>		 
										<mytag:List table="Menu" name="menuList" >menuParent=0</mytag:List>
										 <logic:iterate id="menu0" name="menuList">
										 	<option value ="${menu0.menuId}">${menu0.menuName}</option>
										          <mytag:List table="Menu" name="menuList" >menuParent=${menu0.menuId}</mytag:List>
												  <logic:iterate id="menu1" name="menuList">
												    <option value ="${menu1.menuId}">┗${menu1.menuName}</option>
												   </logic:iterate>
										   </logic:iterate>
										</select>
						</td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">排序：</td>
						<td><input name="save_menuSort" value="0" size="5" id="menuSort" />　*必填 默认 0 </td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">链接地址：</td>
						<td><input name="menuUrl" />　非必填 例如：addform.jsp </td>
					</tr>
					<tr onMouseOver="mouseOver(this)" onMouseOut="mouseOut(this)">
						<td align="right">操作键：</td>
						<td><input name="actionKey" id="actionKey" />　*必填 例如：adduser </td>
					</tr>
					<tr>
						<td colspan="2" class="form_button" style="padding-top:10px;">
							<input type="submit" value="保存" />
							<input type="reset" value="重置" />
						</td>
					</tr>
			</table>
			</form>
		</div>
	</div>
</div>
</body>
</html>
